<template>
  <div class="app-container" v-loading="loading">
    <el-descriptions title="" border>
      <el-descriptions-item label="税源地">{{ form.taxCompanyName }}</el-descriptions-item>
      <el-descriptions-item label="任务名称">{{ form.taskName }}</el-descriptions-item>
      <el-descriptions-item label="价格">{{ form.money }}{{ form.unit }}</el-descriptions-item>
      <el-descriptions-item label="所需人数">{{ form.staffNum }}人</el-descriptions-item>
      <el-descriptions-item label="类型">
        <el-tag type="success" v-if="form.type === 1">分包</el-tag>
        <el-tag v-else-if="form.type === 2">众包</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="是否结算">
        <el-tag type="warning" v-if="form.isSettlement === 0">待结算</el-tag>
        <el-tag v-else-if="form.isSettlement === 1">已结算</el-tag>
        <el-tag type="success" v-else-if="form.isSettlement === 2">结算中</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="开始日期">{{ form.startDate }}</el-descriptions-item>
      <el-descriptions-item label="截止日期">{{ form.endDate }}</el-descriptions-item>
      <!--      <el-descriptions-item label="工作时间">{{ form.workingHours }}</el-descriptions-item>-->
      <!--      <el-descriptions-item label="休息时间">{{ form.breakHours }}</el-descriptions-item>-->

      <el-descriptions-item :span="3" label="任务标签">
        <el-tag style="margin-right: 5px" v-for="(item,index) in taskTip" :key="index" >{{ item }}</el-tag>
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>
<script>
import { getTask } from "@/api/system/task"
export default {
  name:"taskDetail",
  props:{
    taskNo:{
      type:String,
      default: null,
    }
  },
  data() {
    return {
      loading: false,
      form:{},
      taskTip:[],
    }
  },
  methods:{
    getDetail(){
      this.loading = true
      getTask(this.taskNo).then(res => {
        this.loading = false
        this.form = res.data
        let taskTip = res.data.taskTip
        if(taskTip){
          this.taskTip = taskTip.split(",")
        }
      }).catch(()=>{
        this.loading = false
      })
    }
  },
  watch: {
    taskNo: {
      handler(val) {
        if (val) {
          this.getDetail()
        }
      },
      immediate: true,
    }
  }
}

</script>
<style scoped lang="scss">

</style>
